const fs = require("fs");
const path = require("path");

const files = fs.readdirSync(__dirname, { withFileTypes: true });

files.forEach((fd) => {
  if (fd.isFile() && /\.(js|css)$/.test(fd.name)) {
    let filecontent = fs.readFileSync(path.join(__dirname, fd.name), {
      encoding: "utf8",
    });
    filecontent = filecontent.replace(/(\d+)vhrem/g, (s, p) => {
      return p + "rem";
    });
    fs.writeFileSync(path.join(__dirname, fd.name), filecontent);
  }
});
